<?php 
defined('IN_TS') or die('Access Denied.');

include 'userinfo.php';

$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsUrl('user','article',array('id'=>$strUser['userid'],'page'=>''));
$lstart = $page*15-15;

$arrArticles = $new['user']->findAll('article',array(
	'userid'=>$strUser['userid'],
),'addtime desc',null,$lstart.',15');

foreach ( $arrArticles as $key => $item ) {
	$arrArticle [] = $item;
	$arrArticle [$key]['title'] = tsTitle($item['title']);
	$arrArticle [$key] ['user'] = aac ( 'user' )->getOneUser ( $item ['userid'] );
	$arrArticle [$key] ['group'] = aac ('group') ->find ( 'group', array (
		'groupid' => $item ['groupid']
	) );
	$arrArticle[$key]['abs'] = cututf8 ( t(tsDecode($item ['content'])), 0, 80 );
	$arrArticle[$key]['abs'] = cututf8 ( t(tsDecode($item ['content'])), 0, 80 );
	if(!$arrArticle[$key]['abs']){
		$img_path =getTextPhotos(tsDecode($item ['content']));
		if($img_path){
			$arrArticle[$key]['abs']='<img width="100%" src="'.$img_path[0].'">';
		}
	}
}

$articleNum = $new['user']->findCount('article',array(
	'userid'=>$strUser['userid']
));
$pageUrl = pagination($articleNum, 15, $page, $url);

$title = $strUser['username'].'的文档';
include template('article');